package com.bocai.kelalacar.ui.car.set.ada;

import android.support.v7.widget.RecyclerView;
import android.view.View;
import android.widget.TextView;

import com.bocai.kelalacar.R;
import com.bocai.kelalacar.base.BaseRecyclerAdapter;
import com.bocai.kelalacar.base.BaseRecyclerViewHolder;
import com.bocai.kelalacar.bean.MyWalletBillBean;

import java.util.List;

import butterknife.BindView;
import butterknife.ButterKnife;

/**
 * Created by yuanfei on 2017/6/22.
 */

public class MyWalletAda extends BaseRecyclerAdapter<MyWalletBillBean.BillsBean> {

    @Override
    public void showData(BaseRecyclerViewHolder viewHolder, int i, List<MyWalletBillBean.BillsBean> mItemDataList) {
        MyViewHolder myViewHolder = (MyViewHolder) viewHolder;
        myViewHolder.tvTitle.setText(mItemDataList.get(i).getMemo());
        myViewHolder.tvData.setText(mItemDataList.get(i).getCreateTime());
        if (mItemDataList.get(i).getBillType() == 1){
            myViewHolder.tvMoney.setText("+"+mItemDataList.get(i).getAmount());
        }else{
            myViewHolder.tvMoney.setText("-"+mItemDataList.get(i).getAmount());
        }
    }

    @Override
    public int getListLayoutId() {
        return R.layout.item_my_wallet;
    }

    @Override
    public RecyclerView.ViewHolder createViewHolder(View view) {
        return new MyViewHolder(view);
    }

    class MyViewHolder extends BaseRecyclerViewHolder {

        @BindView(R.id.tv_title)
        TextView tvTitle;
        @BindView(R.id.tv_data)
        TextView tvData;
        @BindView(R.id.tv_money)
        TextView tvMoney;

        public MyViewHolder(View itemView) {
            super(itemView);
            ButterKnife.bind(this, itemView);
        }
    }
}
